#pragma once
#include "BaseAcc.h"
#include "BBox.h"
#include "Cell.h"

namespace mray{

struct OcNode{
	OcNode();
	~OcNode();
	Cell*		m_pCell;
	OcNode*		m_child;
};

struct OcTree : public BaseAcc{
	OcTree();

	void Build(BaseObject** ppObjects, uint nObjects) override;
	void Build(Triangle** ppTriangles, uint nTriangles) override;
	bool Hit(Ray& ray, Result* pResult)const override;

private:
	OcNode* m_root;
	BBox m_sceneBox;
	float m_boxLen;

	void BuildNode(const BBox& box, BaseObject* pobject);
	void GetNode();
};

}